package org.biubiu0002.baiblog.common.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: biubiu0002
 * @Date: 2022/11/2 12:50
 **/
public class OAuthConstants {

    @Getter
    @AllArgsConstructor
    public enum TypeEnum{
        WECHAT(1,"微信"),
        QQ(2,"QQ"),
        WEIBO(3,"微博"),
        BAIDU(4,"百度"),
        GITHUB(5,"github"),
        GITEE(6,"gitee"),
        ;

        private Integer code;
        private String platform;

    }


    public static class Gitee{
        public static final String getCode2TokenRequestUrl(String code,String clientId, String redirectUri, String clientSecret){
            return String.format("https://gitee.com/oauth/token?grant_type=authorization_code&code=%s&client_id=%s&redirect_uri=%s&client_secret=%s",code,clientId,redirectUri,clientSecret);
        }

        public static final String getUserInfoRequestUrl(String accessToken){
            return String.format("https://gitee.com/api/v5/user?access_token=%s",accessToken);
        }

        public static final String getRefreshTokenRequestUrl(String refreshToken){
            return String.format("https://gitee.com/oauth/token?grant_type=refresh_token&refresh_token=%s", refreshToken);
        }

    }
}
